package registnet.records.summary.freq;

import java.util.HashMap;

import registnet.records.College;
import registnet.records.DefaultCourse;
import resources.Constants;

public class GradeFrequency {

	private College college;
	private DefaultCourse course;
	private int semester;
	private int year;
	private HashMap<String, Integer> frequencies = new HashMap<String, Integer>();
	
	public GradeFrequency(DefaultCourse course, int semester, int year){
		this.course = course;
		this.semester = semester;
		this.year = year;
		this.initialize();
	}
	
	public GradeFrequency(College college, DefaultCourse course, int semester, int year){
		this.college = college;
		this.course = course;
		this.semester = semester;
		this.year = year;
		this.initialize();
	}

	public College getCollege() {
		return college;
	}

	public void setCollege(College college) {
		this.college = college;
	}

	public DefaultCourse getCourse() {
		return course;
	}

	public void setCourse(DefaultCourse course) {
		this.course = course;
	}
	
	public int getSemester(){
		return this.semester;
	}
	
	public void setSemester(int semester){
		this.semester = semester;
	}
	
	public int getYear(){
		return this.year;
	}
	
	public void setYear(int year){
		this.year = year;
	}

	public int getFrequency(String grade){
		return this.frequencies.get(grade);
	}
	
	public HashMap<String, Integer> getFrequencies(){
		return this.frequencies;
	}
	
	public void setFrequency(String grade, Integer count){
		this.frequencies.put(grade, count);
	}
	
	private void initialize(){
		for(int i=0; i<Constants.GRADE.length; i++){
			this.frequencies.put(Constants.GRADE[i], 0);
		}
	}
}
